@extends('admin.layout.main')

@section('title')
    权限列表
@endsection

@section('content')
    <div class="text-c">
        <form class="Huiform" method="post" action="" target="_self">
            <input type="text" class="input-text" style="width:250px" placeholder="权限名称" id="" name="">
            <button type="submit" class="btn btn-success" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜权限节点</button>
        </form>
    </div>
    <p></p>
    <p></p>

    <form action="{{url('admin/roles/'.$adminRole->id.'/doPermission')}}" method="post">
        {{csrf_field()}}
        <table class="table table-border table-bordered table-bg">
            <thead>

            <tr class="text-c">
                <th width="25"><input type="checkbox" name="" value=""></th>
                <th width="40">ID</th>
                <th width="200">权限名称</th>
                <th>权限描述</th>

            </tr>
            </thead>
            <tbody>

            @foreach($permissions as $permission)
            <tr class="text-c">
                @if($adminRole->hasPermission($permission))
                    <td><input type="checkbox" checked value="{{$permission->id}}" name="permission[]"></td>
                @else
                    <td><input type="checkbox" value="{{$permission->id}}" name="permission[]"></td>
                @endif


                <td>{{$permission->id}}</td>
                <td>{{$permission->name}}</td>
                <td>{{$permission->description}}</td>
            </tr>
            @endforeach

            </tbody>
        </table>
        <input hidden="hidden" name="roleId" value="{{$adminRole->id}}"/>
        <button type="submit" class="bnt btn-success">提交</button>

    </form>
@endsection